<?php
/*
 * 程序入口
 * 作者：陈丹
 * 联系方式:QQ 254009604 E-mail:libcd2009@gmail.com
 * 创建时间：2011-07-11
*/
header("Content-type: text/html; charset=utf-8");
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
//定义常量，模板初始化，数据库连接
include_once 'include'.DS.'init.php';
include_once 'include'.DS.'smarty.init.php';
require_once MODEL_PATH.DS.'Category.php';
require_once MODEL_PATH.DS.'News.php';
require_once MODEL_PATH.DS.'About.php';
$News = new News();
$news_cate = $News->getAllNewsCate();
$About = new About();
$Category = new Category();
$pro_cat = $Category->getCategoryByPid(0,0,100);
$contactus = $About->getAbout('contact');

$tpl->assign('news_cate',$news_cate);
$tpl->assign('pro_cat',$pro_cat);
$tpl->assign('contactus',$contactus);
//模块
$module = isset($_GET['mod']) ? strtolower(htmlentities($_GET['mod'],ENT_QUOTES)) : 'home';
$controller = isset($_GET['act']) ? strtolower(htmlentities($_GET['act'],ENT_QUOTES)) : 'index';
//$action = isset($_GET['act']) ? strtolower(htmlentities($_GET['act'],ENT_QUOTES)) : 'index';

define('MODULE', $module);
define('CONTROLLER', $controller);
define('ACTION', $action);

if(file_exists(MODULE_PATH.DS.MODULE.DS.CONTROLLER.'.php')){
	include MODULE_PATH.DS.MODULE.DS.CONTROLLER.'.php';
}else{
	echo '你访问的模块不存在！请返回首页';
	exit;
}
?>